﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using CompactMapper.Orm.Annotations;

namespace CompactMapper.Orm.UnitOfWork.Mappings.Meta.PropertyInfos.Relations
{
    public class HasAndBelongsToMany : Relation
    {
        private readonly HasAndBelongsToManyAttribute _attribute;
        private readonly String _tableName;

        public HasAndBelongsToMany(PropertyInfo propertyInfo)
            : base(propertyInfo)
        {
            _attribute = GetManyToManyAttribute();
            _tableName = GetSomethingToManyTableName();
        }

        

        public HasAndBelongsToManyAttribute HasAndBelongsToManyAttribute
        {
            get { return _attribute; }
        }

        public override string TableName
        {
            get { return _tableName; }
        }
    }
}